package com.meituan.catering.management.shop.dao.mapper;

import com.meituan.catering.management.shop.api.http.model.request.*;
import com.meituan.catering.management.shop.dao.model.ShopDO;
import com.meituan.catering.management.shop.dao.model.request.SearchShopDataRequest;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * @Author:ale
 * @Date 2022/4/22 16:58
 * @Version 1.0
 */
@Mapper
public interface ShopMapper {

    /**
     * 通过商户号查看商户信息
     * @param businessNo
     * @return
     */
    ShopDO findByBusinessNo(String businessNo);

    /**
     * 创建一家门店
     * @param tenantId
     * @param businessNo
     * @param request
     * @return
     */
    int create(@Param("tenantId") Long tenantId, @Param("businessNo") String businessNo, CreateShopHttpRequest request);

    /**
     * 通过商户号更新商户信息
     * @param businessNo
     * @param request
     * @return
     */
    int update(@Param("businessNo") String businessNo, UpdateShopHttpRequest request);

    /**
     * 关闭一家门店
     * @param businessNo
     * @param request
     * @return
     */
    int close(@Param("businessNo")String businessNo,CloseShopHttpRequest request);

    /**
     * 打开一家门店
     * @param businessNo
     * @param request
     * @return
     */
    int open(@Param("businessNo")String businessNo, OpenShopHttpRequest request);

    /**
     * 分页搜索
     * @param request
     * @return
     */
    List<ShopDO> allList(SearchShopHttpRequest request);

    /**
     * 分页搜索 - 获取总条数
     * @return
     */
    Integer countForPageOne();

    /**
     * 精确匹配操作 - 获取总条数
     * @param request
     * @return
     */
    Integer countForPage(SearchShopDataRequest request);

    /**
     * 精确匹配获取数据
     * @param request
     * @return
     */
    List<ShopDO> searchForPage(SearchShopDataRequest request);

    /**
     * 查找下属的id
     */
    Set<Long> findSubordinateIds(@Param("tenantId") Long superiorId);
}
